<template>
  <div> 
    <div class="main_navigator fCenterY">
          <!-- <el-page-header @back="goBack" acontent="详情页面"></el-page-header> -->
      <div>
        <i class="el-icon-back"></i>
        <span class="navigator_span" @click="goBack">返回</span>
        &nbsp;&nbsp;
        <span style="color:#d4d4d4">|</span>
      </div>&nbsp;&nbsp;&nbsp;
      <el-breadcrumb aseparator=">" separator-class="el-icon-arrow-right" style="font-size:16px;">
        <!-- <el-breadcrumb-item><span @click="goBack" style="cursor:pointer;">返回</span> </el-breadcrumb-item>-->
        <el-breadcrumb-item>{{crumbOne}}</el-breadcrumb-item>
        <el-breadcrumb-item>
          <span :class="active_crumb">{{crumbTwo}}</span>
        </el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <div class="main_content">
      <div class="name">
        <div class="child_name">
          <!-- <el-row>
            <span>项目名词：</span>
            <el-input v-model="project_noun" placeholder="请输入项目名词" clearable style="width:50%" disabled></el-input>
          </el-row>
          <el-row>
            <span>定义规范：</span>
            <el-input type="textarea" v-model="texts" placeholder="请输入定义规范" clearable style="width:50%" disabled></el-input>
          </el-row> -->
          <el-row>
            <el-col :span="17" style="text-align:center">
              
              <!-- &nbsp;&nbsp;&nbsp;&nbsp;<i class="el-icon-refresh"></i>
              <span style="color:green">{{status}}</span> -->
            </el-col>
          </el-row>

       
          <el-form id="help" :model="theDetails" ref="theDetails" label-width="100px">
            <el-form-item label="帮助字段：" prop="project_noun">
              <el-input v-model="theDetails.project_noun" style="width:100%;"></el-input>
            </el-form-item>
            <el-form-item label="规范详情：" prop="texts">
              <el-input type="textarea" v-model="theDetails.texts" :rows="10" style="width:100%;"></el-input>
            </el-form-item>
            <el-form-item label="规范补充：">
              <el-input type="textarea" v-model="theDetails.supplement_text" :rows="10" style="width:100%;"></el-input>
            </el-form-item>
          </el-form>
          <div style="display:flex;justify-content:center">
            <el-button type="primary" @click="editFunction()">确定</el-button>
          </div>
          <div style="padding-left:12px;margin-top:50px;display:flex;justify-content:space-between">
            <div>操作人：<span>{{modify_person}}</span></div>
            <div>操作时间：<span>{{modify_time}}</span></div>
          </div>
        </div>  
      </div>
    </div>
  </div> 
</template>
<script>
import myhttp, {
  isEmpty,
  msgError,
  msgSuccess,
  msgWarning
} from "../../utils/myhttp";
import qs from "qs";
import api from "../../utils/api";
export default {
  data() {
    return {
      active_crumb: "active_crumb", //面包屑当前颜色
      crumbOne: "帮助管理",
      crumbTwo: "编辑",
      loading: "",
      theRow: {}, //当前行数据
      theIndex: 0, //当前下标
      searchText: "", //搜索字段
      definition_norm:"",
      status:"已同步",
      help_id: this.$route.params.help_id,
     
      modify_person: this.$route.params.modify_person,
      modify_time: this.$route.params.modify_time,
      theDetails:{
        supplement_text:this.$route.params.supplement_text,
        texts: this.$route.params.texts,
        project_noun: this.$route.params.project_noun,
      },
    };
  },
  components: {},
  methods: {
    doSearch() {
      //搜索方法
      this.editFunction();
    },
    handleSelectionChange(val) {
      //处理多选
      this.multipleSelection = val;
      this.multiIDS = val.map(element => element.id);
      this.hasMultiDelete = val.length !== 0;
    },
    handleCurrentChange(val) {
      //分页查询
      this.nowPage = val;
      this.editFunction();
    },
    openLoading() {
      //loading请求等待
      this.loading = this.$loading({
        lock: true,
        text: "Loading",
        spinner: "el-icon-loading",
        background: "rgba(0, 0, 0, 0.7)"
      });
    },
    editFunction() {
      if(isEmpty(this.theDetails.project_noun)){
        msgWarning(this, "帮助字段不能为空");
      } else{
        this.doEdit();
      }
    },
    doEdit: async function(){
      var res = await $.post('updateHelp',{
        helpId: this.help_id,// 帮助
        text: this.theDetails.texts,// 定义规范
        projectNoun: this.theDetails.project_noun,// 项目名词
        modifyPerson: this.modify_person,// 修改人
        supplementText: this.theDetails.supplement_text,//补充
        // supplementText:'',
      });
      if(!res.success) return $.msgError(res.msg||'error!');
      $.msgSuccess(res.msg||'success!');
    },
    goBack() {
      // this.$router.go(-1);
       this.$router.push({name:'helpManagement'});
    },
  },
  created() {},
  mounted() {}
};
</script>
<style scoped>
  .name{
    border:1px solid #d4d4d4;
    padding:40px 0 40px 30px;
  }
  .child_name{
    padding-bottom:20px;
    width:60%;
  }
  /* .child_name .el-row:first-child{
    padding:20px 0;
  }
  .child_name .el-row:nth-child(2){
    padding:10px 0 20px 0;
  }
  .child_name .el-row:nth-child(3){
     margin: 30px 0 40px 0;
  } */
  .active_crumb {
    color: rgb(90, 160, 230);
  }
</style>


